<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container{
            width: 80px;
            height: 40px;
            border-radius: 20px;
            background-color:#dcdfe6;
            box-shadow: 0 0 3px #ccc inset;
        }
        .ball{
            width: 38px;
            height: 38px;
            border-radius:50% ;
         background-color: #fefefe;
            line-height: 25px;
             box-shadow: 0 0 3px #ccc;
        }
        .box{
            display: flex;
            line-height: 40px;
            
        }
        .aa{
            transform: translateX(100%);
            transition: all 1s ease;
           
        }
         .bb{
            transform: translateX(0);
            transition: all 1s ease;
           
        }
        .bc{
            color: #409eff;
             transition: all 1s ease;
        }
        .bg{
          background-color: #409eff;
           transition: all 1s ease;
        }

    </style>
</head>
<body>
    <div id="app">
           <div class="box">
            <div :class="obj.bb?'bc':''">按年收费</div>
                <div  class="container" :class="obj.aa? 'bg':''">
                    <div class="ball" :class="obj" @click="domove()"></div>
                </div>
            <div :class="obj.aa?'bc':''">按月收费</div>
           </div>
        
    </div>
    <script type="module">
        import { createApp } from "../assets/vue3/vue.esm-browser.js";
        createApp({
            data() {
                return {
                   
                    obj:{
                        aa:true,
                        bb:false
                        
                    }
                }
            },
            methods:{
                domove() {
                    

                        this.obj.aa = !this.obj.aa
                        this.obj.bb=!this.obj.bb
                    
                }
            }
        }).mount("#app");
    </script>
</body>
</html>